<template>
  <div class="house-detail-container">
    <h2>{{ houseDetail.title }}</h2>
    <p>价格: {{ houseDetail.price }} 元/月</p>
    <p>房屋描述: {{ houseDetail.description }}</p>
  </div>
</template>

<script>
export default {
  name: "HouseContainer",
  data() {
    return {
      houseDetail: {},
    };
  },
  created() {
    // 获取路由参数 id
    const houseId = this.$route.params.id;
    // 模拟从数据源获取房源信息
    const houseList = [
      {
        id: 1,
        title: "金沙雅苑(二期)",
        price: 111,
        description: "精装一室，靠近地铁站。",
      },
      {
        id: 2,
        title: "宜居生活",
        price: 1234,
        description: "精致两室，周边设施完善。",
      },
    ];
    // 根据 id 查找房源详细信息
    this.houseDetail = houseList.find((house) => house.id == houseId) || {};
  },
};
</script>

<style scoped>
.house-detail-container {
  padding: 20px;
  background-color: #f0f2f5;
}

.header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.back-button {
  margin-right: 10px;
  background-color: #4caf50;
  color: white;
  padding: 5px 10px;
  border: none;
  cursor: pointer;
}

.community-name {
  font-size: 20px;
  font-weight: bold;
}

.banner {
  margin-bottom: 20px;
}

.banner-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.house-info {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.house-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
}

.house-tag {
  display: inline-block;
  background-color: #007bff;
  color: white;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 12px;
  margin-bottom: 20px;
}

.price-info {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}

.price-info div {
  text-align: center;
  font-size: 16px;
  color: #c62828;
}

.additional-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.info-item {
  width: calc(50% - 5px);
  font-size: 14px;
  color: #555;
}

.label {
  font-weight: bold;
}

.footer-actions {
  display: flex;
  justify-content: space-around;
  background-color: white;
  padding: 10px 0;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
}

.action-button {
  flex: 1;
  text-align: center;
  padding: 10px;
  color: #4caf50;
  border: none;
  background: none;
  font-weight: bold;
  cursor: pointer;
}

.call-button {
  color: white;
  background-color: #4caf50;
  border-radius: 4px;
}
</style>